﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TERP.WaterClient.Common
{
	public abstract class WorkerProcess
	{
		protected WorkerProcessListener _listener;

		public WorkerProcess(WorkerProcessListener listener){
			this._listener = listener;
		}

		public void StartProcess()
		{
			DoWork();
			_listener.ProccessFinished();
		}

		public virtual void DoWork(){

		}

		public void Interupt()
		{
			_shouldInterupt = true;
		}

		protected volatile bool _shouldInterupt;
	}

	public interface WorkerProcessListener
	{
        void PercentCompleted(int percent);
		void ProccessFinished();
		void SetProgressText(string text);
		void SetProcessResult(object result);
	}
}
